package com.stefanini.pe.bbva.mbl.in.dao;

import com.stefanini.pe.bbva.mbl.carga.in.to.ConfiguracionSchema;
import com.stefanini.pe.bbva.mbl.in.dao.iface.ConfiguracionSchemaDAO;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class ConfiguracionSchemaDAOImpl extends SqlMapClientDaoSupport implements ConfiguracionSchemaDAO {

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table IIPG.TIIPG_SCHEMA_CONFIG
     *
     * @ibatorgenerated Thu Oct 21 17:25:53 COT 2010
     */
    public ConfiguracionSchemaDAOImpl() {
        super();
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table IIPG.TIIPG_SCHEMA_CONFIG
     *
     * @ibatorgenerated Thu Oct 21 17:25:53 COT 2010
     */
    public int deleteByPrimaryKey(BigDecimal idAplicativo) {
        ConfiguracionSchema key = new ConfiguracionSchema();
        key.setIdAplicativo(idAplicativo);
        int rows = getSqlMapClientTemplate().delete("IIPG_TIIPG_SCHEMA_CONFIG.ibatorgenerated_deleteByPrimaryKey", key);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table IIPG.TIIPG_SCHEMA_CONFIG
     *
     * @ibatorgenerated Thu Oct 21 17:25:53 COT 2010
     */
    public void insert(ConfiguracionSchema record) {
        getSqlMapClientTemplate().insert("IIPG_TIIPG_SCHEMA_CONFIG.ibatorgenerated_insert", record);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table IIPG.TIIPG_SCHEMA_CONFIG
     *
     * @ibatorgenerated Thu Oct 21 17:25:53 COT 2010
     */
    public void insertSelective(ConfiguracionSchema record) {
        getSqlMapClientTemplate().insert("IIPG_TIIPG_SCHEMA_CONFIG.ibatorgenerated_insertSelective", record);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table IIPG.TIIPG_SCHEMA_CONFIG
     *
     * @ibatorgenerated Thu Oct 21 17:25:53 COT 2010
     */
    public ConfiguracionSchema selectByPrimaryKey(BigDecimal idAplicativo) {
        ConfiguracionSchema key = new ConfiguracionSchema();
        key.setIdAplicativo(idAplicativo);
        ConfiguracionSchema record = (ConfiguracionSchema) getSqlMapClientTemplate().queryForObject("IIPG_TIIPG_SCHEMA_CONFIG.ibatorgenerated_selectByPrimaryKey", key);
        return record;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table IIPG.TIIPG_SCHEMA_CONFIG
     *
     * @ibatorgenerated Thu Oct 21 17:25:53 COT 2010
     */
    public int updateByPrimaryKeySelective(ConfiguracionSchema record) {
        int rows = getSqlMapClientTemplate().update("IIPG_TIIPG_SCHEMA_CONFIG.ibatorgenerated_updateByPrimaryKeySelective", record);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table IIPG.TIIPG_SCHEMA_CONFIG
     *
     * @ibatorgenerated Thu Oct 21 17:25:53 COT 2010
     */
    public int updateByPrimaryKey(ConfiguracionSchema record) {
        int rows = getSqlMapClientTemplate().update("IIPG_TIIPG_SCHEMA_CONFIG.ibatorgenerated_updateByPrimaryKey", record);
        return rows;
    }
    
    public List selectAll() {
    	System.out.println("select All ");
        List records = getSqlMapClientTemplate().queryForList("IIPG_TIIPG_SCHEMA_CONFIG.ibatorgenerated_selectAll", null);         
        return records;      
    }
    
    public String consultarSchemaActivo(){
    	List lista=this.getSqlMapClientTemplate().queryForList("IIPG_TIIPG_SCHEMA_CONFIG.consultar_schema_activo");
    	Map result=(HashMap)lista.get(0);
    	return  (String)result.get("SCHEMA_ACTIVO");
    }
    
}